package cn.flying.cloud.file.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;

import cn.flying.cloud.file.bo.FileInfoBo;

/**
 * 文件信息表
 *
 * @author admin
 * @since 2025-09-24 10:17:37
 */
@TableName("file_info")
public class FileInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 请求流水号
     */
    @TableField("request_no")
    private String requestNo;

    /**
     * 所属服务编码
     */
    @TableField("service_code")
    private String serviceCode;

    /**
     * 所属服务名称
     */
    @TableField("service_name")
    private String serviceName;

    /**
     * 文件类型
     */
    @TableField("file_type")
    private String fileType;

    /**
     * 文件名称
     */
    @TableField("file_name")
    private String fileName;

    /**
     * 文件地址
     */
    @TableField("file_url")
    private String fileUrl;

    /**
     * 桶名
     */
    @TableField("bucket_name")
    private String bucketName;

    /**
     * 桶存储文件
     */
    @TableField("bucket_file")
    private String bucketFile;

    /**
     * 厂商编码
     */
    @TableField("vendor_code")
    private String vendorCode;

    /**
     * 厂商名称
     */
    @TableField("vendor_name")
    private String vendorName;

    /**
     * 备注
     */
    @TableField("remark")
    private String remark;

    /**
     * 创建人
     */
    @TableField(value = "created_by", fill = FieldFill.INSERT)
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    private LocalDateTime createdTime;

    /**
     * 修改人
     */
    @TableField(value = "updated_by", fill = FieldFill.INSERT_UPDATE)
    private String updatedBy;

    /**
     * 修改时间
     */
    @TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updatedTime;

    /**
     * 租户ID
     */
    @TableField("tenant_id")
    private String tenantId;

    /**
     * 乐观锁版本号
     */
    @TableField(value = "revision", fill = FieldFill.INSERT)
    @Version
    private Long revision;

    /**
     * 删除标识
     */
    @TableField(value = "deleted", fill = FieldFill.INSERT)
    @TableLogic
    private String deleted;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getRequestNo() {
        return requestNo;
    }

    public void setRequestNo(String requestNo) {
        this.requestNo = requestNo;
    }

    public String getServiceCode() {
        return serviceCode;
    }

    public void setServiceCode(String serviceCode) {
        this.serviceCode = serviceCode;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getFileType() {
        return fileType;
    }

    public void setFileType(String fileType) {
        this.fileType = fileType;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getFileUrl() {
        return fileUrl;
    }

    public void setFileUrl(String fileUrl) {
        this.fileUrl = fileUrl;
    }

    public String getBucketName() {
        return bucketName;
    }

    public void setBucketName(String bucketName) {
        this.bucketName = bucketName;
    }

    public String getBucketFile() {
        return bucketFile;
    }

    public void setBucketFile(String bucketFile) {
        this.bucketFile = bucketFile;
    }

    public String getVendorCode() {
        return vendorCode;
    }

    public void setVendorCode(String vendorCode) {
        this.vendorCode = vendorCode;
    }

    public String getVendorName() {
        return vendorName;
    }

    public void setVendorName(String vendorName) {
        this.vendorName = vendorName;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getCreatedBy() {
        return createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public LocalDateTime getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(LocalDateTime createdTime) {
        this.createdTime = createdTime;
    }

    public String getUpdatedBy() {
        return updatedBy;
    }

    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    public LocalDateTime getUpdatedTime() {
        return updatedTime;
    }

    public void setUpdatedTime(LocalDateTime updatedTime) {
        this.updatedTime = updatedTime;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public Long getRevision() {
        return revision;
    }

    public void setRevision(Long revision) {
        this.revision = revision;
    }

    public String getDeleted() {
        return deleted;
    }

    public void setDeleted(String deleted) {
        this.deleted = deleted;
    }

    @Override
    public String toString() {
        return "FileInfo{" +
                "id = " + id +
                ", requestNo = " + requestNo +
                ", serviceCode = " + serviceCode +
                ", serviceName = " + serviceName +
                ", fileType = " + fileType +
                ", fileName = " + fileName +
                ", fileUrl = " + fileUrl +
                ", bucketName = " + bucketName +
                ", bucketFile = " + bucketFile +
                ", vendorCode = " + vendorCode +
                ", vendorName = " + vendorName +
                ", remark = " + remark +
                ", createdBy = " + createdBy +
                ", createdTime = " + createdTime +
                ", updatedBy = " + updatedBy +
                ", updatedTime = " + updatedTime +
                ", tenantId = " + tenantId +
                ", revision = " + revision +
                ", deleted = " + deleted +
                "}";
    }

    public FileInfoBo toBO() {
        FileInfoBo bo = new FileInfoBo();
        bo.setId(this.id);
        bo.setRequestNo(this.requestNo);
        bo.setServiceCode(this.serviceCode);
        bo.setServiceName(this.serviceName);
        bo.setFileType(this.fileType);
        bo.setFileName(this.fileName);
        bo.setFileUrl(this.fileUrl);
        bo.setBucketName(this.bucketName);
        bo.setBucketFile(this.bucketFile);
        bo.setVendorCode(this.vendorCode);
        bo.setVendorName(this.vendorName);
        bo.setRemark(this.remark);
        bo.setCreatedBy(this.createdBy);
        bo.setCreatedTime(this.createdTime);
        bo.setUpdatedBy(this.updatedBy);
        bo.setUpdatedTime(this.updatedTime);
        bo.setTenantId(this.tenantId);
        bo.setRevision(this.revision);
        bo.setDeleted(this.deleted);
        return bo;
    }

    public FileInfo fromBO(FileInfoBo bo) {
        this.setId(bo.getId());
        this.setRequestNo(bo.getRequestNo());
        this.setServiceCode(bo.getServiceCode());
        this.setServiceName(bo.getServiceName());
        this.setFileType(bo.getFileType());
        this.setFileName(bo.getFileName());
        this.setFileUrl(bo.getFileUrl());
        this.setBucketName(bo.getBucketName());
        this.setBucketFile(bo.getBucketFile());
        this.setVendorCode(bo.getVendorCode());
        this.setVendorName(bo.getVendorName());
        this.setRemark(bo.getRemark());
        this.setCreatedBy(bo.getCreatedBy());
        this.setCreatedTime(bo.getCreatedTime());
        this.setUpdatedBy(bo.getUpdatedBy());
        this.setUpdatedTime(bo.getUpdatedTime());
        this.setTenantId(bo.getTenantId());
        this.setRevision(bo.getRevision());
        this.setDeleted(bo.getDeleted());
        return this;
    }
}
